﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM
{
    #region Using Statements

    using System;

    #endregion

    /// <summary>
    /// This represents the content of a comment, i.e., all the characters 
    /// between the starting '<!--' and ending '-->'. Note that this is the
    /// definition of a comment in XML, and, in practice, HTML, although 
    /// some HTML tools may implement the full SGML comment structure. 
    /// </summary>
    public class Comment : CharacterData
    {
        #region Constructors

        internal Comment(Comment c)
            : base(c.ownerDocument, c.data)
        {
        }

        internal Comment(Document owner, string data)
            : base(owner, data)
        {
        }

        #endregion

        #region DOM Level 1 Compliance

        public override Node cloneNode(bool deep)
        {
            return new Comment(this);
        }

        public override string nodeName
        {
            get { return "#comment"; }
        }

        public override string nodeValue
        {
            get { return data; }
        }

        public override byte nodeType
        {
            get { return COMMENT_NODE; }
        }

        #endregion

        public override string ToString()
        {
            return String.Format("<!-- {0} -->", data);
        }
    }
}
